<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8">
    <style type="text/css">
        fieldset{width: 350px;background:#4876FF;height: 200px;margin: 150px 400px 0px}
        button{maogin: 0; padding: 0}
    </style>
</head>
<body bgcolor="#7EC0EE">
<form action="/login" method="POST">
    <fieldset>
        <legend align="center">用户登录</legend><br/>
        <label>用户：</label>
        <input type="text" name="name" id="name"/>（请输入用户名）<br/><br/>
        <label>密码：</label>
        <input type="password" name="password" id="password"/>（输入密码）<br/><br/>
        <input type="submit" name="" value="提交" onclick="return check()">
        <input type="button" name="" value="重置" onclick="clear()">
        <p>{{.Message}} <span id="view"></span></p>
    </fieldset>
</form>
</body>

<script type="text/javascript">
    {{if .IsLogin}}
    t = 5; // 计数器
    view.innerHTML = "，["+t+"]秒后跳转";
    setInterval("locationTime()",1000); // 启动1秒定时
    function locationTime() {
        if(t<1) location = "/index.html";
        view.innerHTML = "，["+t+"]秒后跳转"; // 显示倒计时
        t--; // 计数器递减
    }
    {{end}}
    function check(){
        var user = name.value;
        var pwd1 = password.value;
        if (user == "" || pwd1 == "") {
            alert("输入的用户名或密码不能为空");
            return false
        }
        if (pwd1.length< 6) {
            alert("密码不能小于六位数！");
            return false
        }
        return true
    }
</script>
</html>
